package com.navi.loaddata.core.repository.impl;

import org.hibernate.Session;
import org.hibernate.jpa.HibernateEntityManager;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * Created by admin on 2017/9/27.
 */
@Repository("daomes")
public class MesRepositoryImpl extends NaviRepositoryImpl {
    /** 实体类管理类对象 */
    @PersistenceContext(unitName = "mesPersistenceUnit")
    private EntityManager entityManager;


    @Override
    public EntityManager getEntityManager() {
        return entityManager;
    }

    public Session getEntityManagerSession() {
        HibernateEntityManager hEntityManager = (HibernateEntityManager)entityManager;
        Session session = hEntityManager.getSession();
        return session;
    }
}
